import request from '@/utils/request'

/**
 * 添加骑手
 * @param { object } data
 * @returns Promise
 */
export function addDelivery(data) {
    return request({
        url: '/api/delivery/add',
        method: 'post',
        data
    })
}

/**
 * 修改骑手
 * @param { object } data
 * @returns Promise
 */
export function editDelivery(data) {
    return request({
        url: '/api/delivery/edit',
        method: 'post',
        data
    })
}

/**
 * 分页获取骑手
 * @param {*} params {
 *  page 页码
 *  limit 页数
 * }
 */
export function findDeliveryList(params) {
    return request({
        url: '/api/delivery/findList',
        method: 'get',
        params
    })
}

/**
 * 获取全部骑手
 * @param {*} params
 * @returns
 */
export function findDeliveryAll(params) {
    return request({
        url: '/api/delivery/findAll',
        method: 'get',
        params
    })
}

/**
 * 删除骑手
 * @param {*} params
 * @returns
 */
export function delDelivery(params) {
    return request({
        url: '/api/delivery/del',
        method: 'delete',
        params: { id: params.id }
    })
}

/**
 * 根据骑手ID获取配送订单组
 * @param {*} params
 * @returns
 */
export function findDeliveryGroupOrders(params) {
    return request({
        url: '/api/delivery/findDeliveryGroupOrders',
        method: 'get',
        params
    })
}

/**
 * 骑手订单配送完成
 * @param {*} data
 * @returns
 */
export function deliveryComplete(data) {
    return request({
        url: '/api/delivery/deliveryComplete',
        method: 'post',
        data
    })
}

/**
 * 转移骑手配送订单
 * @param {*} data
 * @returns
 */
export function transferDeliveryOrder(data) {
    return request({
        url: '/api/delivery/transferDeliveryOrder',
        method: 'post',
        data
    })
}

/**
 * 骑手订单变更
 * @param {*} data
 * @returns
 */
export function transformOrderDelivery(data) {
    return request({
        url: '/api/delivery/transformOrderDelivery',
        method: 'post',
        data
    })
}

// export function exportDeliveryOrders(params) {
//     return request({
//         url: '/api/delivery/exportDeliveryOrder'
//         method: ''
//     })
// }
